package com.example.smart.adapter.home

import android.app.Activity
import android.view.LayoutInflater
import android.view.ViewGroup
import com.example.lib.extend.setOnDoubleClickListener
import com.example.smart.R
import com.example.smart.base.adapter.BaseRecyclerAdapter
import com.example.smart.base.adapter.BaseViewHolder
import com.example.smart.databinding.ItemVaccinesMBinding
import com.example.smart.utils.DisplayUtils

class MVaccinesAdapter(val activity: Activity) : BaseRecyclerAdapter<ItemVaccinesMBinding, Int>(activity) {

    init {
        updateList(mutableListOf(R.mipmap.m_pp4,
            R.mipmap.m_pp5,
            R.mipmap.m_pp6,
            R.mipmap.m_pp7,
            R.mipmap.m_pp8,
            R.mipmap.m_pp9,
            R.mipmap.m_pp10,
            R.mipmap.m_pp11,
            R.mipmap.m_pp12))
    }

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder<ItemVaccinesMBinding> {
        return BaseViewHolder(ItemVaccinesMBinding.bind(LayoutInflater.from(context)
            .inflate(R.layout.item_vaccines_m, parent, false)))
    }

    override fun onBindView(itemView: ItemVaccinesMBinding, bean: Int, position: Int) {
        itemView.ItemText.setImageResource(bean)
        itemView.root.setOnDoubleClickListener {
            DisplayUtils.toVaccinesDetails(activity)
        }
    }
}